
public class DecoratorPatternDemo {
    public static void main(String[] args) {
        Beverage beverage = new Espresso();
        System.out.println(beverage.cost());

        Beverage milk = new Milk(beverage);
        System.out.println(milk.cost());

        Beverage mocha = new Mocha(beverage);
        System.out.println(mocha.cost());

        Beverage milkAndMocha = new Milk(new Mocha(beverage));
        System.out.println(milkAndMocha.cost());

        Beverage milkWhip = new Milk(new Whip(beverage));
        System.out.println(milkWhip.cost());
    }
}
